package zuoye;
public class Student {

	private String name, num, idCard;
	private int age;

	public String getNum() {
		return num;
	}

	public void setNum(String num) {
		this.num = num;
	}

	public Student(String name, int age, String num, String idCrad) {
		super();
		this.name = name;
		this.setAge(age);
		this.num = num;
		this.idCard = idCrad;
	}

	public void setAge(int age) {
		this.age = age > 15 && age <= 25 ? age : 20;
	}

	public int getAge() {
		return age;
	}

	public void show() {
		System.out.println(num + "\t" + getAge() + "\t" + name + "\t" + idCard);
		System.out.println();
	}

	@Override
	public boolean equals(Object obj) {
		if (!(obj instanceof Student)) {
			return false;
		}
		Student st = (Student) obj;
		return this.num.equals(st.num);
	}

}
